<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>设备态势-右侧-图表</title>

        <style>
            body,
            html {
                margin: 0;
                padding: 0;
                color: white;
                width: max-content;
                height: max-content;
            }
        </style>
    </head>
    <body>
        <script src="../../config.js"></script>
        <script>
            init()
            function init() {
                let web_token = Fuck('func_db', null, 'get', JSON.stringify({ key: 'web_token', default: '' }))
                let web_projId = Fuck('func_db', null, 'get', JSON.stringify({ key: 'web_projId', default: '' }))
                if (!web_token) {
                    console.error('未获取到token，请检查token是否正确')
                }

                // PUE
                this.CreateOrSetUIPage2('DeviceViewOrderAnaly', 444, -113, 420, 423, window.iotWebConfig?.designUrl + '?code=component_xDc9TYWfXu&token=' + web_token + '&projId=' + web_projId, 1)
                // UPS1
                this.CreateOrSetUIPage2('DeviceViewAlarmStatistics', 444, -560, 420, 395, window.iotWebConfig?.designUrl + '?code=component_Q6XihT1Tgs&token=' + web_token + '&projId=' + web_projId, 1)
            
                // // 告警事件
                // this.CreateOrSetUIPage2(
                //     'ViewDeviceAlarmEvent',
                //     888,
                //     -113,
                //     420,
                //     230,
                //     window.iotWebConfig?.webUrl + '/pages/common/message.html?height=260&pageType=message',
                //     1
                // )

                // 功率
                this.CreateOrSetUIPage2('DeviceViewEquipMaintenance', -24, -113,420, 423, window.iotWebConfig?.designUrl + '?code=component_eHdkPrhM3J&token=' + web_token + '&projId=' + web_projId, 3)
                // UPS2
                this.CreateOrSetUIPage2('DeviceViewEquipStatistics', -24, -560, 420, 395, window.iotWebConfig?.designUrl + '?code=component_kclLoLBOi2&token=' + web_token + '&projId=' + web_projId, 3)
            
                Fuck("func_html_chrome", "DeviceViewOrderAnaly", "set_render_sort", 9999);
                Fuck("func_html_chrome", "DeviceViewAlarmStatistics", "set_render_sort", 9999);
                Fuck("func_html_chrome", "DeviceViewEquipMaintenance", "set_render_sort", 9999);
                Fuck("func_html_chrome", "DeviceViewEquipStatistics", "set_render_sort", 9999);

            }
            // 创建或者设置一个右侧的数据页面
            // 使用了淡入淡出效果
            function CreateOrSetUIPage2(id, x, y, width, height, source, anchor = 3, transform = '1,1') {
                var arg = {
                    id,
                    x,
                    y,
                    width,
                    height,
                    anchor: anchor,
                    source,
                    transform,
                    blur: true,
                    radius: 6,
                    group: '_RDP_',
                    animation: {
                        name: 'fade+transform',
                        from_x: 24
                    }
                }

                Fuck('func_html_chrome', null, 'create_page', JSON.stringify(arg))
            }
        </script>
    </body>
</html>
